import { defineConfig } from 'vitepress'
import { generateSidebar } from "vitepress-sidebar";
//import { set_sidebar } from "../utils/auto_sidebar.js";
import autoGetSidebarOptionBySrcDir from "./sidebar";
import path from "node:path";

const vitepressSidebarOptions = { 
  documentRootPath: "/docs", 
  collapsed: false, //折叠组关闭 
  collapseDepth: 2, //折叠组2级菜单 
  removePrefixAfterOrdering: true, //删除前缀，必须与prefixSeparator一起使用
  prefixSeparator: "_", //删除前缀的符号
};  

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "LIDAPAO",
  description: "随便记记",
  srcDir: "docs",//等下需要新建一个目录，统一放这里 
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '首页', link: '/' },
      { text: 'Java', link: '/Java/01.Java基础' },
	  { text: '前端', link: '/Vue/' },
	  { text: '数据库', link: '/MySQL/' },
	  { text: '框架', link: '/SpringBoot/' },
	  { text: 'Linux', link: '/Linux/' },
	  { text: 'About', link: '/About/01.关于项目' },
    ],

    //sidebar: generateSidebar(vitepressSidebarOptions),
	//侧边栏
	sidebar: {
	"/Java": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/Java"),
        "Java"
      ),
	  "/前端": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/Vue"),
        "前端"
      ),
	  "/数据库": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/MySQL"),
        "MySQL"
      ).concat(autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/Redis"),
        "Redis"
      )),
	  "/框架": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/SpringBoot"),
        "SpringBoot"
      ),
	 "/Linux": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/Linux"),
        "Linux"
      ),
	  "/About": autoGetSidebarOptionBySrcDir(
        path.resolve(__dirname, "../docs/About"),
        "关于"
      ),
    },
	outlineTitle:"文章标题",
    outline:[1,6],// 定义标题级别,字符串"deep"相当于是[2,6] 
    socialLinks: [
      { icon: 'github', link: 'https://github.com/' }
    ],
	search: {
      provider: "local",
	},
	lastUpdated: true,
	//文章左下角编辑按钮
	//editLink: { pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path'},
	 footer: {
		message: "Released under the MIT License.",
		copyright: "Copyright ©李大炮",
	},
  }
})
